package com.project.personalfundmanager.shared.models;

import com.extjs.gxt.ui.client.data.BaseModel;
import com.project.personalfundmanager.client.common.ModelHelper;
import com.project.personalfundmanager.shared.DAOs.PayableTaxDAO;

public class PayableTaxModel extends BaseModel
{
	private static final long serialVersionUID = 1L;

	public PayableTaxModel()
	{
	}

	public PayableTaxModel( PayableTaxDAO dao )
	{
		setCalculatedIncome( dao.getTotalIncome() );
		setTaxableIncome( dao.getTaxableIncome() );
		setRawTax( dao.getRowTax() );
		setSurcharge( dao.getSurcharge() );
		setEducationCess( dao.getEducationCess() );
		setTaxPayable( dao.getTaxPayable() );
	}

	public static void copyToModel( PayableTaxModel fromModel, PayableTaxModel toModel )
	{
		toModel.setCalculatedIncome( fromModel.getCalculatedIncome() );
		toModel.setTaxableIncome( fromModel.getTaxableIncome() );
		toModel.setRawTax( fromModel.getRawTax() );
		toModel.setSurcharge( fromModel.getSurcharge() );
		toModel.setEducationCess( fromModel.getEducationCess() );
		toModel.setTaxPayable( fromModel.getTaxPayable() );
	}

	public void setCalculatedIncome( int totalIncome )
	{
		set( "calculatedIncome", totalIncome );
	}

	public Integer getCalculatedIncome()
	{
		return ModelHelper.getNullSafeInt( get( "calculatedIncome" ) );
	}

	public void setTaxableIncome( int taxableIncome )
	{
		set( "taxableIncome", taxableIncome );
	}

	public Integer getTaxableIncome()
	{
		return ModelHelper.getNullSafeInt( get( "taxableIncome" ) );
	}

	public void setRawTax( int rawTax )
	{
		set( "rawTax", rawTax );
	}

	public Integer getRawTax()
	{
		return ModelHelper.getNullSafeInt( get( "rawTax" ) );
	}

	public void setSurcharge( int surcharge )
	{
		set( "surcharge", surcharge );
	}

	public Integer getSurcharge()
	{
		return ModelHelper.getNullSafeInt( get( "surcharge" ) );
	}

	public void setEducationCess( int educationCess )
	{
		set( "educationCess", educationCess );
	}

	public Integer getEducationCess()
	{
		return ModelHelper.getNullSafeInt( get( "educationCess" ) );
	}

	public void setTaxPayable( int taxableIncome )
	{
		set( "taxPayable", taxableIncome );
	}

	public Integer getTaxPayable()
	{
		return ModelHelper.getNullSafeInt( get( "taxPayable" ) );
	}
}
